﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using DataLib.Accounts.Bus;

namespace Ewts.Project
{
    public partial class AddressByProjectList : System.Web.UI.Page
    {
        public string loadid = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string username = "";
                int proid = 0;
                if (Session["UserInfo"] != null)
                {
                    User curUser = new DataLib.Accounts.Bus.User();
                    curUser = (User)Session["UserInfo"];
                    username = curUser.UserName;
                    if (Request["proid"] != null)
                    {
                        proid = int.Parse(Request["proid"].ToString().Trim());
                    }
                    if (!string.IsNullOrEmpty(Request["LoadID"]))
                        {
                            loadid = Request["LoadID"].ToString().Trim();
                            proid = new DataLib.BLL.LoadNum().GetProidByLoadid(loadid);
                        }
                        else
                        {
                            loadid = "0";
                        }
                    }
                  bindData(username, proid);
              }
              else
              {
                    Response.Redirect("/accounts/login.aspx");
              }
            

        }

        /// <summary>
        /// 绑定数据
        /// </summary>
        /// <param name="username"></param>
        private void bindData(string username,int proid)
        {
            DataTable dt = new DataTable();
            dt = new DataLib.BLL.ProjectsRelation().getAddressByUserName(username, 1,proid,0);
            rept.DataSource = dt;
            rept.DataBind();

        }

        
    }
}